package com.soap.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.soap.commons.ReturnCommons;
import com.soap.entity.po.Goods;
import com.soap.entity.po.Orders;
import com.soap.entity.query.OrderQuery;
import com.soap.manager.OrderManager;
import com.soap.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderManager orderManager;

    @Override
    public String getOrderListByPage(OrderQuery orderQuery) {
        Page<Orders> page = new Page<>(orderQuery.getPage(), orderQuery.getLimit());
        QueryWrapper<Orders> wrapper = new QueryWrapper<>();
        wrapper.orderByDesc("create_time");
        IPage<Orders> goodsIPage = orderManager.page(page , wrapper);
        return ReturnCommons.getSuccess(goodsIPage);
    }
}
